package com.example.unisys.service;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.unisys.dao.IpMapper;
import com.example.unisys.entity.Ip;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class IpService extends ServiceImpl<IpMapper,Ip> {

    public List<Ip> getIps(int start, int page){
        return baseMapper.getIps(start,page);
    }


    public int insert(Ip ip){
        return baseMapper.insertSelective(ip);
    }

    public int delete(int ip_id){
        return baseMapper.delete(ip_id);
    }

    public Integer getIpSum(){
        return baseMapper.getIpSum();
    }

    public List<Ip> getBySchool(HashMap<String,Object> map){
        return baseMapper.getBySchool(map);
    }

    public Integer getBySchoolSum(Map map){
        return baseMapper.getBySchoolSum(map);
    }


    public int forbidIP(int ip_id) {
        return baseMapper.forbidIP(ip_id);
    }

    public int startIP(int ip_id) {
        return baseMapper.startIP(ip_id);
    }

    public List<Ip> getAllowIp(Map<String,Object> map){
        return baseMapper.getAllowedIp(map);
    }
}
